Skip to content

feat: report rows in DEFAULT that no maintenance run would reach - #94

Merged
AlexeyShalaev merged 2 commits into
masterfrom
feat/report-rows-in-default
Oct 4, 2026
Merged

AlexeyShalaev merged 2 commits into
masterfrom
feat/report-rows-in-default

Conversation

@AlexeyShalaev

Copy link
Copy Markdown
Member

From alexluong's review of the Outpost recipe (hookdeck/outpost#1110): Outpost's publish API accepts a client-supplied time, so after adoption an event dated in a month with no partition lands in events_default. He inserted one dated 2025-06 and one in a month retention had already dropped. plan --check said "nothing to do" and exited 0, and apply --allow-destructive left both rows where they were. Creation walks forward from the cursor, so no run ever came back for that window, and retention can't drop rows that were never in a partition.

plan now reports this as rows_in_default (WARNING): plan --check exits 3, and apply carries the finding in result.issues. backfill already moves such rows into a partition of their own.

The earliest row in DEFAULT decides whether to report. It is read with the same index probe partition_data uses (get_leading_key_minimum), so the provider protocol doesn't change. A row in a window the same plan creates is moved by that plan's attach, and a row dated ahead of the cursor is moved by the run that reaches its window, so neither is reported. That keeps an ordinary adoption apply from warning about the current month it is about to attach. The history that backfill hasn't moved yet is reported until it has, and the docs say so. ActualTree.default_earliest carries the value.

Tests:

  • planner: a past window is reported; a window the plan creates and a window ahead of the cursor are not.
  • inspection (both mirrors): the probe runs against the DEFAULT partition only; no DEFAULT or a non-RANGE root means no read.
  • integration (both mirrors): adopt, insert a row dated 2025-06, then plan reports it, partition_data moves it, and plan is clean again. With the planner call removed, the integration test fails.

Results: unit 2871 passed, integration (PG 17) 575 passed, ruff and mypy clean, docs build clean.

A row written with a key outside every partition after adoption lands
in DEFAULT, and if its window is behind the cursor nothing ever comes
back for it: no apply creates that window again, retention cannot drop
it, and plan said there was nothing to do. Outpost's publish API takes
a client-supplied time, which is how its maintainer found it.

plan now reports it as rows_in_default (WARNING), so plan --check exits
3 and apply carries it in result.issues; backfill moves the rows into a
partition of their own. The earliest row in DEFAULT decides, read with
the index probe partition_data already uses: rows of a window the same
plan creates are left to its attach, and rows ahead of the cursor to
the run that reaches them. ActualTree.default_earliest carries it.
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AlexeyShalaev
AlexeyShalaev merged commit e9cb25b into master Oct 4, 2026
32 checks passed
@AlexeyShalaev
AlexeyShalaev deleted the feat/report-rows-in-default branch October 4, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant